<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRoleMenuPermissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('role_menu_permission', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->integer('role_id')->default(0)->comment('角色ID');
            $table->integer('menu_id')->default(0)->comment('菜单表ID');
            $table->unsignedInteger('permission_id')->default('0')->comment('权限表ID');
            $table->unsignedInteger('created_user_id')->default('0')->comment('管理员ID');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('role_menu_permission');
    }
}
